package com.example.wyy;

import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import util.BlurUtil;

public class MusicListActivity extends AppCompatActivity implements View.OnClickListener {
    private ImageView bitmain;
    private LinearLayout back_ground;
    private TextView list_introduction;
    private ImageView backto;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_music_list);

        bitmain = findViewById(R.id.bitmian);
        back_ground = findViewById(R.id.back__);
        list_introduction = findViewById(R.id.list_introduction);
        backto = findViewById(R.id.backto);
        backto.setOnClickListener(this);

        Intent intent = getIntent();
        int pic = intent.getIntExtra("pic", 0);
        String desc = intent.getStringExtra("desc");
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(),pic);
        Bitmap bitm = BlurUtil.doBlur(bitmap, 10, 10);
        bitmain.setImageResource(pic);
        back_ground.setBackground(new BitmapDrawable(bitm));
        list_introduction.setText(desc);

    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.backto){
            finish();
        }
    }
}